package com.gsafety.wellsfort.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gsafety.wellsfort.common.enums.CustomerTypeEnum;
import com.gsafety.wellsfort.common.enums.QuestionTypeEnum;
import com.gsafety.wellsfort.domain.model.knowledge.Question;
import com.gsafety.wellsfort.domain.model.knowledge.Work;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "作业")
public class WorkVO {
    /**
     *
     */
    private Integer id;


    @ApiModelProperty(value = "面向对象")
    private Integer objectType;

    @ApiModelProperty(value = "面向对象文本表示")
    private String objectTypeText;


    @ApiModelProperty(value = "作业标题")
    private String workTitle;


    @ApiModelProperty(value = "包含题数")
    private String includeQuestionInfo;

    @ApiModelProperty(value = "建议时长")
    private Integer duration;


    @ApiModelProperty(value = "发布次数")
    private Integer publicTimes;

    @ApiModelProperty(value = "及格分数")
    private BigDecimal passingScore;

    @ApiModelProperty(value = "当前总分数")
    private BigDecimal currentTotalScore;


    @ApiModelProperty(value = "修改人")
    private Integer modified;



    @ApiModelProperty(value = "修改人名字")
    private String modifiedName;



    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;
    public static  class VOBuilder{
        Work q ;
        WorkVO qVo=new WorkVO();
        public VOBuilder(Work q){
            this.q=q;
        }
        public WorkVO build(){
            BeanUtils.copyProperties(q,qVo);
            qVo.setObjectTypeText(CustomerTypeEnum.parseVal(qVo.getObjectType()).label);
            return qVo;
        }
    }
}
